package {
    import org.flixel.*;
  
    // Test State to check object construction
    public class TestState extends FlxState {
        public function TestState() {
            super();
        }
  
        // Locals
        private var levelFloor:Platform;
        private var wallGroup:FlxGroup;
        
        private var startDoor:Door;
        private var finishDoor:Door;
        
        private var player:Player;
    
    
        override public function create():void {
            FlxG.bgColor = 0xffcccccc;

            // Create floor and add to wall group
            levelFloor = new Platform(0, 290, 400, 300, true);
            wallGroup = new FlxGroup();
            wallGroup.add(levelFloor);
            wallGroup.add(new Platform(0, 0, 2, 290, true));
            wallGroup.add(new Platform(398, 0, 2, 290, true)); 
            
            // Create starting point and goal point
            startDoor = new Door(10, 290-25, false);
            finishDoor = new Door(370, 290 - 25, true);
            
            // Create player
            player = new Player(10, 290-20, this);
            
            // Add all elements
            add(startDoor);
            add(finishDoor);
            add(wallGroup);
            add(player);
            

        }
        
        // Add Collision, Ink drawing, goal state, etc
        override public function update():void {
        
            super.update();
            
            // player.update();
            
            // Add collision between player and platforms
            FlxG.collide(player, wallGroup);
            
        }
        
        // Add Ink
        public function addInk(X:Number, Y:Number):void {
            FlxG.log("Creating new Ink Point");
            var inkPoint:Platform = new Platform(X, Y, 1, 2, true);
            wallGroup.add(inkPoint);
        }
    }
}